<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>红色带选择器</title>
    <link rel="stylesheet" href="styles.css">
</head>
<style>
    body {
        font-family: Arial, sans-serif;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        margin: 0;
        background-color: #f4f4f4;
    }

    .color-picker {
        text-align: center;
    }

    input[type="range"] {
        width: 300px;
        height: 20px;
        -webkit-appearance: none;
        appearance: none;
        background: linear-gradient(to right, #ff0000, #ff6666, #ffcccc, #ffffff, #ffcccc, #ff6666, #ff0000);
        border-radius: 10px;
        outline: none;
    }

    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 25px;
        height: 25px;
        background-color: #ffffff;
        border-radius: 50%;
        border: 2px solid #aaa;
    }

    .color-display {
        margin-top: 20px;
        font-size: 18px;
    }

    #current-color {
        font-weight: bold;
    }

</style>
<body>

<div class="color-picker">
    <label for="red-hue-slider">选择红色调：</label>
    <input type="range" id="red-hue-slider" min="0" max="360" value="0" />
    <div id="color-display" class="color-display">当前选择颜色：<span id="current-color">#ff0000</span></div>
</div>

<script>
    document.getElementById('red-hue-slider').addEventListener('input', function(event) {
        const hue = event.target.value;
        const color = `hsl(${hue}, 100%, 50%)`; // 使用 HSL 模式生成红色调颜色
        document.getElementById('current-color').textContent = color;
        document.getElementById('current-color').style.color = color;
        document.getElementById('color-display').style.backgroundColor = color;
    });


</script>
</body>
</html>
